package com.SmartCare.schedule;

import com.SmartCare.common.Result;
import com.SmartCare.service.medicine.MedicationRecordService;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;

@Component
public class MedicationRecordsTask {

    @Resource
    private MedicationRecordService medicationRecordService;

    @Scheduled(cron="0 0 0 * * *")
    public void execute(){
        //每天零点生成当天记录
        Result result = medicationRecordService.generateTodayRecords();
        if(result.getCode().equals("200")){
            System.out.println("今日药单记录生成成功");
        }else{
            System.out.println("今日药单记录生成失败");
        }
    }
}
